package com.shuyun.xxx.guava.offer;

import org.junit.Test;

/**
 * Created by goodb on 2017/5/21.
 */
public class ReverseList {
    private static class Node{
        private int data;
        private Node next;
        public Node(int data){
            this.data = data;
        }
    }
    public Node reverse(Node node){
        Node pre = null;
        Node next = null;
        while(node != null){
            next = node.next;
            node.next = pre;
            pre = node;
            node = next;
        }
        return pre;
    }
}
